const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : '0' + n
}
let  data={};
function getAjax(url, data, success, fail) {
  wx.request({
    url: url,
    header: {
      'content-type': 'application/json',
    },
    method: 'GET',
    data: data,
    success(res) {
      success(res);
      
    },
    fail(res) {
      fail(res);
    }
  });

}

function postAjax(url, req, success, fail) {
  wx.request({
    url: url,
    header: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    method: 'POST',
    data:req,
    success:function(res) {
      success(res);
      console.log(req)
      
      
    },
    fail(res) {
      fail(res);
    }
  });
}


// 股东信息假数据

var skt = [
  {
    name:'何涛',
    photo:'/images/girl.jpg',
    amount:'60万人民币',
    time:'2016-06-20',
    ratio:'60.00',
    bigskt: true,
    id:0,
    paidTime:'2026-06-19',
  },
  {
    name: '张六六',
    photo: '/images/girl.jpg',
    amount: '40万人民币',
    time: '2016-06-20',
    ratio: '40.00',
    bigskt:false,
    id:1,
    paidTime: '2026-06-19',
  }
]

// 企业年报假数据

var Co_annals = [
  {
    year:'2018年度',
    year_number:'2018',
    listid:0

  },
  {
    year: '2017年度',
    year_number: '2017',
    listid: 1
  },
  {
    year: '2016年度',
    year_number: '2016',
    listid: 2,
    skt:[
      {
       sktname:'张六六'   
      },
      {
        sktname: '何涛'   
      }
    ]
  }

]




module.exports = {
  formatTime: formatTime,
  postAjax: postAjax,
  getAjax: getAjax,
  skt_mess:skt,
  Co_annals: Co_annals
  
}
